<?
/////////////////////////////////////////////////////////////////////////////
//      Target Country by IP Address  - advanced redirection
//		- for MySql, Plain text databases-
//	Copyright (C) 2003 Jgsoft Associates - http://www.analysespider.com/
/////////////////////////////////////////////////////////////////////////////
//  If somewhere on your website, you want to apply other redirection rules, in other files, you could use the same databases and the same script. 
//All you can make a copy of _re_rules.dat -> new_re_rules.dat,edit new_re_rules.dat, just change the REDIRECTION RULES. 
//Then include it in your files with $re_rules = "new_re_rules.dat" , $anp_path="cr/"; include($anp_path."cr.php");

       // apply other redirection rules file
       if (empty($re_rules))
        $re_rules ="cur_re_rules.dat";

	$anp_db_type="text";		// IP -> country Database type
					// Possible options: "mysql", "text"
					// "mysql" : data is placed in a mysql database on your server
					// "text" : data is in one or more .dat files on your server

//END General Options
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//START MySql oprions

	// NOTE: The MySql database can have only IP numbers.
	$anp_mysql_host = "localhost";	// MySQL hostname
	$anp_mysql_user = "root";			// MySQL user anp
	$anp_mysql_pass = "";			// MySQL password
	$anp_mysql_dbname = "_anp";		// MySQL database name
	$anp_mysql_table="anp_ip2country";	// Default: "anp_ip2country"
//END MySql oprions
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//START Plain text database options

	//Note: The plain text database can have either IP numbers or IP addresses
      // If you purchased ip2country Redirector, this is the name of the plain text database file. Use "anp_ips.dat" for the commercial www.analysespider.com IP -> country database.

	$anp_text_db_name="anp_ips.dat";

	$anp_text_db_ip_type="numbers";	// Options: "numbers", "addresses"
				// the type of IP addresses in the IP database, IP numbers (3242324222) or IP addresses (192.168.0.2)
									
//END Plain text database options
//////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
//START General Options
	define("_DEBUG_MODE","0");	// Debug Mode on/off
						// Possible options: "0", "1", "2"
						// "0" (Debug Mode off) means that this script will not print any information. Cookies will be set, so the detection will take place only once per session. If you change the redirection rules, to test or check the actions of the script you have to close all browser windows, and open a new browser window to your site.
						// "1" (Debug Mode on) means that the script prints runtime information above all the html of your site. this shows you step by step what is this script doing. When debug mode is on (1) no cookie will be set, so the detection takes place each time the script is executed.
						// "2" (Debug Mode on) means that the script will print all runtime information but will also set cookies and session variables, So the country detection takes place only once, then it is loaded from cookie/session vars.
      define("_NODE_ID","Redirection ID");		//This is the ID/Name of this set of redirection rules.

	$anp_default_reject_link="";
                // Blocks certain IP address's from your site and redirects the user to the blocked page. Leave blank (="") to take no action, and to load your pages for this visitors (use an invalid url to display a 404 error message to the visitor - ex: "index.php").

	$anp_default_redirect_link="";	
		// This is the URL where visitors who are in a country that has no REDIRECTION RULE specified will be redirected; ="" means no URL and your pages are loaded (visitors are accepted) (use an invalid url if you want to display a 404 error message to the visitor - ex: "index.asphp")

	$anp_url_save_method="session";		// The method used to save the country code for a certain visitor, in order to avoid searching the database every time he requests a page.
						// Possible options: "cookie", "session"
						// "cookie" : this sets a cookie in the visitor`s browser who expire in one year. The problem might be that the visitor could disable cookies for your domain, and the detection will be repeated each time he requests a page with RV installed. Also if you change the redirection rules, the redirection url saved in the visitor`s browser will not be updated. You`ll have to change the _NODE_ID in order to make sure all returning visitors are redirected like in the new set of rules. This method is not secure, the visitor might have the knowledge to change the value of the country code saved in his browser, and this way he could visit sections of your website not accessible to his country...
						// "session" : this way the country code is saved on the server and it`s secure in case you restrict access to your pages from certain countries, but the session expires when the user closes his browser, so the detection will take place each time the visitor comes back to your website. Also this way a ?PHP_SESSID might be added to the URL of your pages if the user disables cookies, this also means that search engine crawlers migh skip pages with RV installed if "session" used.
//END General Options
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//START Redirection Rules
//Description: You can specify for each country a redirection link (URL), you could place a blank as redirection link (use an invalid url to display a 404 error message to the visitor - ex: "index.asphp") or you could comment the line (the default reject link will be used). By default you have a list of all countries but all have blank redirection links and the lines are commented. Here there are 244 country rule lines but the free database included in this distribution (available from http://ip-to-country.com) has only 179 countries and it`s by far not as accurate and updated as our commercial database, available at http://www.analysespider.com
//Structure: <ISO Country code>=<Redirection link>

// EDIT cur_re_rules.dat

//END Redirection Rules
//////////////////////////////////////////////////////////////////////////////


/*////////////////////////////////////////////////////////////////////////////
//Blocks certain IP address's from your site

// EDIT blocked_ips.dat		//Exceptions (the script do not execute) apply to all visitors with IP addresses included in blocked_ips.dat so edit and place there all IP addresses or IP ranges you want to be excluded from the scan process.

//END Exceptions
////////////////////////////////////////////////////////////////////////////*/

?>